<html>
<head><meta charset="utf-8"><title>DefId Vs NodeID · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/DefId.20Vs.20NodeID.html">DefId Vs NodeID</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="219380414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/DefId%20Vs%20NodeID/near/219380414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/DefId.20Vs.20NodeID.html#219380414">(Dec 09 2020 at 18:50)</a>:</h4>
<p>Hi, </p>
<p>Trying to understand the DefID when the representation of the Program is an AST and not HIR.</p>
<p>My confusion is that I thought the AST only deals  with NodeID? </p>
<p>Also my understanding is that if DefID uniquely identifies an element in a crate, then it cannot be present in the AST unless parsing cannot be done in parallel?</p>



<a name="219380608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/DefId%20Vs%20NodeID/near/219380608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/DefId.20Vs.20NodeID.html#219380608">(Dec 09 2020 at 18:51)</a>:</h4>
<p>Where is <code>DefId</code> used for the AST?</p>



<a name="219381330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/DefId%20Vs%20NodeID/near/219381330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/DefId.20Vs.20NodeID.html#219381330">(Dec 09 2020 at 18:56)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> I saw it in rustc_resolve , which I thought was for the AST?</p>



<a name="219381370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/DefId%20Vs%20NodeID/near/219381370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/DefId.20Vs.20NodeID.html#219381370">(Dec 09 2020 at 18:57)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_resolve/late.rs.html#1-2436">https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_resolve/late.rs.html#1-2436</a></p>



<a name="219381624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/DefId%20Vs%20NodeID/near/219381624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/DefId.20Vs.20NodeID.html#219381624">(Dec 09 2020 at 18:58)</a>:</h4>
<p>I think the <code>DefId</code>'s here are assigned once the respective items won't be removed or fundamentally changed anymore.</p>



<a name="219382352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/DefId%20Vs%20NodeID/near/219382352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> kev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/DefId.20Vs.20NodeID.html#219382352">(Dec 09 2020 at 19:03)</a>:</h4>
<p>Oh I see, was away trying to verify this, but it makes sense if that is the case. I think this means that Macros are eagerly assigned DefIds when we have the AST, or something like that?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>